package com.baosight.sczx.zm.ca.service;

import java.util.Calendar;

import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.zm.ca.domain.VZMCA13;
import com.baosight.sczx.common.zm.Utils;
public class ServiceZMCA13 extends ServiceEPBase{
	/**
	 * 页面初始化，返回组织好的层级小代码
	 * 
	 * @param EiInfo
	 * @return EiInfo
	 */
	public EiInfo initLoad(EiInfo inInfo) {
		return inInfo;//this.query(inInfo);
	}

	public EiInfo queryByIndex(EiInfo inInfo) {
		VZMCA13 m = new VZMCA13();
		EiInfo outInfo = super.query(inInfo, "ZMCA13.queryByIndex", m);	
		outInfo.addBlock(Utils.generateOutBlock("queryByDepartment", m, inInfo, "ZMCA13.queryIndexByDepartment", false));
		return outInfo;
	}
	
	public EiInfo queryByChart(EiInfo inInfo) {
		VZMCA13 m = new VZMCA13();
		inInfo.addBlock(Utils.generateOutBlock("queryByYear", m, inInfo, "ZMCA13.queryByYear", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByYearClassify", m, inInfo, "ZMCA13.queryByYearC", false));

		Calendar currentTime = Calendar.getInstance(); 
		inInfo.set("month", ""+(currentTime.get(Calendar.MONTH)+1));
		inInfo.set("year", ""+currentTime.get(Calendar.YEAR));
		return inInfo;
	}
	
	public EiInfo queryByListView(EiInfo inInfo) {
		VZMCA13 m = new VZMCA13();
		inInfo.addBlock(Utils.generateOutBlock("queryByYear", m, inInfo, "ZMCA13.queryByYearYes2", false));
		//ZMCA13.queryByDepartment的sql语句为了不产生后新的javabean，利用VZMCA13的一些属性去存储其他的属性
		//其中用"fdWorknum"保存"fdResponseDepartmentId",而 fdResponseDepartmentId保存了单位名称
		//fdClassify保存单位层级，fdSourceClassify保存父单位
		inInfo.addBlock(Utils.generateOutBlock("queryByDepartment", m, inInfo, "ZMCA13.queryByDepartment", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByListC", m, inInfo, "ZMCA13.queryByListC", false));
		
		Calendar currentTime = Calendar.getInstance(); 
		inInfo.set("month", ""+(currentTime.get(Calendar.MONTH)+1));
		inInfo.set("year", ""+currentTime.get(Calendar.YEAR));
		return inInfo;
	}
}
